package com.sds.shop.action;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sds.fw.mvc.Action;
import com.sds.fw.mvc.HttpUtil;
import com.sds.fw.util.DBUtil;
import com.sds.shop.dao.BoardDAO;
import com.sds.shop.dao.CategoryDAO;
import com.sds.shop.vo.BoardVO;

public class BoardListAction extends Action {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
		try{
			String page = request.getParameter("page");
			if(page == null || page.equals("")) page  = "1";
			
			request.setAttribute("page", page);
			request.setAttribute("boardList", (ArrayList<BoardVO>)BoardDAO.getInstance().getBoardListWithReply());
			HttpUtil.forward(request, response, "/jsp/boardList.jsp");
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}
}
